
package com.fis.mca.persistence;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;


/**
 * <p>Java class for cycle complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="cycle">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="cycleFees" type="{http://www.w3.org/2001/XMLSchema}anyType" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="cycleId" type="{http://www.w3.org/2001/XMLSchema}int"/>
 *         &lt;element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="numDay" type="{http://www.w3.org/2001/XMLSchema}int"/>
 *         &lt;element name="status" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "cycle", propOrder = {
    "cycleFees",
    "cycleId",
    "description",
    "numDay",
    "status"
})
public class Cycle implements Comparable<Cycle>{

    @XmlElement(nillable = true)
    protected List<Object> cycleFees;
    protected int cycleId;
    protected String description;
    protected String numDay;
    protected String status;

    /**
     * Gets the value of the cycleFees property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the cycleFees property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getCycleFees().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link Object }
     * 
     * 
     */
    public List<Object> getCycleFees() {
        if (cycleFees == null) {
            cycleFees = new ArrayList<Object>();
        }
        return this.cycleFees;
    }

    /**
     * Gets the value of the cycleId property.
     * 
     */
    public int getCycleId() {
        return cycleId;
    }

    /**
     * Sets the value of the cycleId property.
     * 
     */
    public void setCycleId(int value) {
        this.cycleId = value;
    }

    /**
     * Gets the value of the description property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getDescription() {
        return description;
    }

    /**
     * Sets the value of the description property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setDescription(String value) {
        this.description = (value == null) ? value : value.trim();
    }

    /**
     * Gets the value of the numDay property.
     * 
     */
    public String getNumDay() {
        return numDay;
    }

    /**
     * Sets the value of the numDay property.
     * 
     */
    public void setNumDay(String value) {
    	this.numDay = (value == null) ? value : value.trim();
    }

    /**
     * Gets the value of the status property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getStatus() {
        return status;
    }

    /**
     * Sets the value of the status property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setStatus(String value) {
        this.status = (value == null) ? value : value.trim();
    }

    public boolean equals(Object obj)
	{
		if (this == obj)
		{
			return true;
		}
		if ((obj == null) || (obj.getClass() != this.getClass()))
		{
			return false;
		}
		// object must be Test at this point
		Cycle cycle = (Cycle) obj;
		return cycleId == cycle.getCycleId();
	}

	@Override
	public int compareTo(Cycle cycle)
	{
		int num = 0;
		int num1 = 0;
		try
		{
			num = Integer.parseInt(numDay);
			num1 = Integer.parseInt(cycle.getNumDay());
			
			return num - num1;
		}
		catch (NumberFormatException ex)
		{
			return numDay.compareTo(cycle.getNumDay());
		}
	}
	
}
